#include <arpa/inet.h>
#include <ctime>
#include <fcntl.h>
#include <iostream>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <xict_common/log/log.h>

class UDPServer {
public:
    UDPServer();
    ~UDPServer();

    void Init();
    void SetServerAddr(const char* ip, int port);
    void SetClientAddr(const char* ip, int port);

    char* ReceiveData();
    void SendData(std::string msg);

private:
    int serverSocket;
    int clientSocket;
    struct sockaddr_in server_addr;   // 创建服务端sockaddr_in结构体
    struct sockaddr_in client_addr;   // 创建客户端sockaddr_in结构体

    char send_info_buf[100], recv_info_buf[100];
    socklen_t client_addr_len;
};
